import {httpClient} from '@/utils/request';
import {Utils} from '@/utils';
import lark from '@/config';
import Cookies from 'js-cookie';

export async function docMeta({docToken, type}) {
  const uuid = Cookies.get('uuid');
  const url = Utils.handleUrl(lark.env.api.DOCS.DOC.V1_META, [docToken]);
  return await httpClient.get({
    url,
    params: {
      uuid,
      type,
    },
  });
}

export async function delDoc({docToken, type}) {
  const uuid = Cookies.get('uuid');
  const url = Utils.handleUrl(lark.env.api.DOCS.DOC.V1_FILE, docToken);
  return await httpClient.delete({
    url,
    params: {
      uuid,
      type,
    },
  });
}

export async function createDoc({folderToken, type}) {
  const uuid = Cookies.get('uuid');
  return await httpClient.post({
    url: lark.env.api.DOCS.DOC.V1_CREATE,
    data: {
      FolderToken: folderToken,
    },
    params: {
      uuid,
      type,
    },
  });
}
